package com.cwnu.exception;

import com.cwnu.result.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @ProjectName: mall-cwnu
 * @Titile: GlobalException
 * @Author: Lucky
 * @Description: 全局的异常处理
 */
@RestControllerAdvice //对RestController进行增强
public class GlobalException {

    @ExceptionHandler({Throwable.class})
    public R exceptionHandler(Throwable ex){
        return R.error().data("errorMsg",ex.getMessage());
    }
}
